
//
//  DetialViewController.m
//  OwnerNews
//
//  Created by lanou3g on 15/8/30.
//  Copyright (c) 2015年 Drawzyn. All rights reserved.
//

#import "DetialViewController.h"
#import "FindingManager.h"
#import "FindModel.h"

@interface DetialViewController ()
@property (nonatomic,strong)UIWebView *webView;
@property (nonatomic,strong)UIView *TopView;
@property (nonatomic,strong)UIButton *BackButton;
@end

@implementation DetialViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    _TopView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 45)];
   // _TopView.layer.cornerRadius = 10;
    _TopView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:_TopView];
    _BackButton = [UIButton buttonWithType:UIButtonTypeSystem];
    _BackButton.frame = CGRectMake(5, 5, 60, 33);
    [_BackButton setTitle:@"Back" forState:UIControlStateNormal];
    [_TopView addSubview:_BackButton];
    [_BackButton addTarget:self action:@selector(dismissViewController) forControlEvents:UIControlEventTouchUpInside];
    FindModel *FM = [FindingManager defaultManager].FindBodyArray[_indexPaths.row];
    _webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, _TopView.frame.size.height, self.view.frame.size.width, self.view.frame.size.height - _TopView.frame.size.height)];
    NSURLRequest *request = [[NSURLRequest alloc]initWithURL:[NSURL URLWithString:FM.jumpUrl]];
    
    [self.view addSubview:_webView];
    
    [_webView loadRequest:request];
    
    self.view.backgroundColor = [UIColor cyanColor];

}

- (void)dismissViewController {
    
    for (UIView *v in [self.view subviews]) {
        [v removeFromSuperview];
    }
    
    [self dismissViewControllerAnimated:YES completion:^{
       
    }];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
